clear all

use "study4data.dta"

*post-only
reg estatetax taxtreat PID ideo if pptreat==0
est store post

*quasi
reg estatetax taxtreat quasi* PID ideo if pptreat==1
est store quasi

*prepost
reg estatetax taxtreat predv PID ideo if pptreat==2
est store pre

suest post quasi pre
test [post_mean]taxtreat=[quasi_mean]taxtreat
test [post_mean]taxtreat=[pre_mean]taxtreat


*main effect graph
gen x=_n
replace x=. if _n>3
gen est=.
gen se=.

reg estatetax taxtreat PID ideo if pptreat==0
est store m1b
replace se=_se[taxtreat] in 1
replace est=_b[taxtreat] in 1
reg estatetax taxtreat predv PID ideo if pptreat==2
est store m2b
replace se=_se[taxtreat] in 2
replace est=_b[taxtreat] in 2
reg estatetax taxtreat quasi* PID ideo if pptreat==1
est store m3b
replace se=_se[taxtreat] in 3
replace est=_b[taxtreat] in 3

gen lo=est-1.96*se
gen hi=est+1.96*se

twoway (scatter est x if x==1, mcol(black)) (scatter est x if x==2, mcol(gray)) (scatter est x if x==3, mcol(sky)) ///
	(rcap lo hi x if x==1, lcol(black)) (rcap lo hi x if x==2, lcol(gray)) (rcap lo hi x if x==3, lcol(sky) ///
	xsc(range(.5 3.5)) xlab(1 "Post-only" 2 "Pre-post" 3 "Quasi", labsize(medsmall)) yline(0) legend(off) ///
	xtitle("") ylab(-.5(.5)1.5, labsize(medsmall)) plotregion(margin(zero)) graphregion(margin(1 1 1 1)) ///
	subtitle("Study 4: Estate Tax") saving(study4.gph, replace))
